﻿using ECO.Admin.Core.EntityCore;
using SqlSugar;
using System.Collections.Generic;

namespace ECO.Admin.Core.Entities.System
{
    [SugarTable("SysRole", TableDescription = "角色表")]
    public class SysRole : EntityBase<int>
    {
        /// <summary>
        /// 角色名
        /// </summary>
        public string RoleName { get; set; }

        /// <summary>
        /// 角色备注
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public string Comments { get; set; }

        /// <summary>
        /// 角色对应的用户
        /// </summary>

        [Navigate(typeof(SysUserRoleMapping), nameof(SysUserRoleMapping.RoleId), nameof(SysUserRoleMapping.UserId))]//注意顺序
        public List<SysUser> Users { get; set; }

        [Navigate(typeof(SysRoleMenuMapping), nameof(SysRoleMenuMapping.RoleId), nameof(SysRoleMenuMapping.MenuId))]//注意顺序
        public List<SysMenu> Menus { get; set; }

    }
}
